package cn.webestar.scms.user.svcapi;

import cn.webestar.scms.commons.R;
import cn.webestar.scms.commons.api.PageVO;
import cn.webestar.scms.microsvc.controller.BaseController;
import cn.webestar.scms.user.api.CorpApi;
import cn.webestar.scms.user.api.dto.Corp.*;
import cn.webestar.scms.user.entity.Corp;
import cn.webestar.scms.user.service.CorpService;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 租户
 */
@RestController
@RequestMapping("/svcapi/Corp")
public class CorpSvcController extends BaseController<Corp, Long> implements CorpApi {

    @Autowired
    private CorpService service;

    @Override
    public IService<Corp> getService() {
        return service;
    }

    @Override
    @PostMapping("/delete")
    public R<Boolean> delete(@RequestParam("id") Long id) {
        return super._delete(id);
    }

    @Override
    @PostMapping("/findById")
    public R<Corp> findById(@RequestParam("id") Long id) {
        return super._findById(id);
    }

    @Override
    @PostMapping("/findByIds")
    public R<Map<Long, Corp>> findByIds(@RequestBody Set<Long> ids) {
        return super._findByIds(ids);
    }

    @Override
    @PostMapping("/create")
    public R<Corp> create(@RequestBody CorpCreateDTO body) {
        return super._create(body);
    }

    @Override
    @PostMapping("/update")
    public R<Corp> update(@RequestBody CorpUpdateDTO body) {
        return super._update(body);
    }

    @Override
    @PostMapping("/page")
    public R<PageVO<Corp>> page(@RequestBody CorpPageDTO body) {
        return super._page(body);
    }

    @Override
    @PostMapping("/findOne")
    public R<Corp> findOne(@RequestBody CorpSimpleDTO body) {
        return super._findOne(body);
    }

    @Override
    @PostMapping("/limitList")
    public R<List<Corp>> limitList(@RequestBody CorpLimitDTO body) {
        return super._limitList(body);
    }

}
